package org.lmind.brick.lib;

import java.io.File;


public class Files {
	
	/**
	 * 返回文件的扩展名，例如"png"  "txt"
	 * @param file
	 * @return
	 */
	public static String getExtension(File file) {
		int index = file.getName().lastIndexOf('.');
		if (index == -1) {
			return "";
		}
		
		return file.getName().substring(index + 1);
	}
	
	public static String getExtension(String filePath) {
		return getExtension(new File(filePath));
	}
	
}
